package com.zrwl.poscloud.core.restapi.file.viewApi;

import com.zrwl.poscloud.xo.service.FileInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.File;

@RestController
@RequestMapping("/fileDeleteApi")
public class FileDeleteApi {
    @Autowired
    FileInfoService fileInfoService;

    //http:localhost:8061/fileDeleteApi/delete
    @RequestMapping("/delete")
    public String delete(String filePath,String uid) {
        File file = new File(filePath);
        if (file.exists()) {
            file.delete();
            fileInfoService.deleteFileInfo(uid);
            return "success";
        } else {
        return "文件不存在";
        }
    }


}
